﻿using System;
using System.Collections.Generic;
using System.Text;
using Castle.ActiveRecord;
using Castle.Components.Validator;
using MiragePWF.NH.Validation;
using Wolfut.MirageEE.Kernal.Common;

namespace Wolfut.MirageEE.Domain.Common
{
    [ActiveRecord]
    public class Department : PersistentObjectWithGuid
    {
        #region 部门代码
        /// <summary>
        /// 部门代码
        /// </summary>
        [Property("DEPT_CODE")]
        [ValidateIsUniqueInSameTransactionWithString(false, "数据库已经存在相同的部门代码")]
        [ValidateNonEmpty, ValidateLength(0, 100, "部门代码超长")]
        public virtual string DeptCode
        {
            get { return deptCode; }
            set { deptCode = value; }
        }

        private string deptCode;
        #endregion

        #region 部门名称
        /// <summary>
        /// 部门名称
        /// </summary>
        [Property("DEPT_NAME")]
        [ValidateIsUnique("数据库已经存在相同的部门名称")]
        [ValidateLength(0, 100, "部门名称超长")]
        public virtual string DeptName
        {
            get { return deptName; }
            set { deptName = value; }
        }

        private string deptName;
        #endregion

        #region 备注
        /// <summary>
        /// 备注
        /// </summary>
        [Property("REMARKS")]
        [ValidateLength(0, 2000, "备注信息超长")]
        public virtual string Remarks
        {
            get { return remark; }
            set { remark = value; }
        }

        private string remark;
        #endregion

        #region 逻辑删除
        private Boolean isDeleted = false;
        [Property("IS_DELETED")]
        public virtual Boolean IsDeleted
        {
            get
            {
                return isDeleted;
            }
            set
            {
                isDeleted = value;
            }
        }
        #endregion
    }
}
